package com.cybertooth.dbconvenience.query.conditions;

import com.cybertooth.dbconvenience.query.columns.Column;
import com.cybertooth.dbconvenience.query.enums.ComparisonOperator;

/**
 * <p></p>
 *
 * @author dnelson
 */
public class ColumnToColumnCondition implements ColumnCondition {

	// -----------------------------------------------------------------------Fields

	protected Column leftColumn;
	protected ComparisonOperator comparisonOperator;
	protected Column rightColumn;

	// -----------------------------------------------------------------Constructors

	public ColumnToColumnCondition(Column leftColumn, ComparisonOperator comparisonOperator, Column rightColumn) {
		this.leftColumn = leftColumn;
		this.comparisonOperator = comparisonOperator;
		this.rightColumn = rightColumn;
	}

	// ---------------------------------------------------------------Public Methods

	/**
	 * {@inheritDoc}
	 */
	@Override
	public String toSql() {
		return new StringBuilder()
				.append(" ")
				.append(this.leftColumn.toSql())
				.append(this.comparisonOperator.toSql())
				.append(this.rightColumn.toSql())
				.append(" ")
				.toString();
	}
}
